package org.mathig.poker.hand;

import java.util.List;

import org.mathig.poker.Card;
import org.mathig.poker.Color;
import org.mathig.poker.PokerRank;

public class Flush extends AbstractHand {

	private List<Card> cards;

	public Flush(List<Card> fiveCards) {
		this.cards = fiveCards;
	}

	public Color getColor() {
		return cards.get(0).getColor();
	}

	public String cards() {
		return cards.toString();
	}

	@Override
	public String toString() {
		return "flush of " + getColor() + ". " + cards;
	}

	public int compareTo(Hand hand) {
		int compare = super.compareTo(hand);
		if (compare != 0)
			return compare;
		if (hand instanceof Flush) {
			Flush flush = (Flush) hand;
			return compareRanks(cards, flush.cards);
		}
		return compare;
	}

	public PokerRank getPokerRank() {
		return PokerRank.FLUSH;
	}
}
